package com.xxx.config;

import java.util.HashMap;
import java.util.Map;

import javax.annotation.PostConstruct;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.view.freemarker.FreeMarkerViewResolver;

@Configuration
public class FreeMarkerConfig{

	@Autowired  
    protected freemarker.template.Configuration configuration; 
	
    @Autowired  
    protected FreeMarkerViewResolver resolver;  
    
    @PostConstruct  
    public void  setFreeMarkerConfig(){
    	Map<String, Object> map = new HashMap<>();
    	map.put("long2date", new LongTimeToDate());
    	map.put("webroot", "http://127.0.0.1:8888");
    	resolver.setAttributesMap(map);
    }
}

